
var WeaponStats = cc.Class({
    name: 'WeaponStats',
    properties: {
        speed: cc.Integer,
        damage: cc.Integer,
        range: cc.Integer,
        timeBetweenAttacks: cc.Integer,
        amount: cc.Integer,
        duration: cc.Integer,
        upgradeText: cc.String,
    },
});


var Weapon = cc.Class({
    extends: cc.Component,

    properties: {
        stats: [WeaponStats],
        weaponLevel: {
			default: 0,
			type: cc.Integer,
			visible: false,
		},

        statsUpdated: {
			default: false,
			visible: false,
		},

        icon: cc.SpriteFrame,
    },

    levelUp () {
        if (this.weaponLevel < this.stats.length - 1) {
            this.weaponLevel++;

            this.statsUpdated = true;
        }
    }

    
});

module.exports = Weapon;
